1. Field of the invention:
The present invention relates to an image processing system which can change the color of a desired area of an image to another color.
2. Description of the prior art:
A color change is one of an image processing technique. For example, when the color of a green leaf in an image is to be changed to yellow, for example, only the area corresponding to the leaf is changed to yellow. This process can be made by replacing the data of R(Red), G(Green) and B(Blue) of each of the pixels forming the area with different data, respectively. Image processing systems which perform such a process are proposed in U.S. Pat. No. 4,878,178. FIG. 13 shows a block diagram of one example of the image processing systems. The system of FIG. 13 comprises a bus 201, a microprocessor 202 which conducts various controls, a main memory 203, a multipurpose memory 204 for storing image information and area information, a look-up table memory 205 for making a color change, a D/A converter 208 for converting digital image signals into analog image signals, a display 209 for visualizing the analog image signals, a pointing device 210 for designating the position of a reference color of the color change, and a color input means 211 for setting the target color of the color change.
The multipurpose memory 204 and look-up table memory 205, which are the most important parts of the image processing system, are diagrammatically shown in FIG. 14. An image inputted from a television camera or scanner is color-separated into three color components of R(Red), G(Green), and B(Blue). The multipurpose memory 204 comprises image information memory regions 301, 302 and 303 each of which stores intensity information of the respective color component, and label information memory sections 311, 312 and 313 for storing labels which will be utilized in distinguishing areas wherein color is to be changed. The look-up table memory 205 comprises transform table memories 321, 322 and 323 corresponding to each color component. In the look-up table memory 205, the intensity information and label information of each of the color components R, G, B which are read out from the multipurpose memory 204 are used as addresses when the contents of the look-up table memory 205 are read out. A function of one variable for conducting the color change is supplied through the gate 212 to the look-up table memory 205 to be stored therein. The contents of the look-up table memory 205 are supplied via the gate 207 as intensity information of each of the three color components R, G, B to the D/A converter 208 to be converted into analog signals which are then displayed as an image by the display 209.
In the multipurpose memory 204, the most significant 6 bits are assigned to the image information and the least significant 2 bits are assigned to the label information of the area. When one of the color components R, G, B is represented by k, the k component (k=r, g or b) of the multipurpose memory 204 consists of the intensity information Ik (O.ltoreq.Ik&lt;2.sup.6) and the label information l(O.ltoreq.l&lt;2.sup.2). Accordingly, the output x of the multipurpose memory 204 is shown as follows: x=2.sup.2 .times.Ik+l.
When the color change is to be performed, the look-up table memory 205 is set in the following manner. The output x of the multipurpose memory 204 is inputted into the look-up table memory 205. The output fk(x) of the k component from the look-up table memory 205 becomes as follows: EQU fk(x)=fk.sup.(0) (x) (when x mod 2.sup.2 =0), EQU fk(x)=fk.sup.(1) (x) (when x mod 2.sup.2 =1), EQU fk(x)=fk.sup.(2) (x) (when x mod 2.sup.2 =2), EQU fk(x)=fk.sup.(3) (x) (when x mod 2.sup.2 =3).
The function fk.sup.(l') (x) (wherein l'=0, 1, 2, 3) is a function which determines the color of each of the areas corresponding to the label information which is 0, 1, 2 or 3. Accordingly, a change of the function fk.sup.(l') (x) corresponding to each of the labels enables an individual color change of each of the areas.
FIG. 15(a) shows an example of a full color image to which four kinds of label information 0, 1, 2 and 3 have been inputted. The color of an area is changed as follows:
(A) The program enters the reference color input mode via a mode selection means. Under the reference color input mode, a point of the area in which the color is to be changed is designated on the image, and then the intensity information Ir, Ig, Ib of the color of the point and also the label information lo of the point are inputted using the pointing device 210. FIG. 15(b) illustrates the input process of the reference color in which a cursor CR is moved in response to the output of the pointing device 210.
(B) The program enters a target color input mode via the mode selection means. In this mode, a color to which the color of the point designated in the reference color input mode is to be changed is inputted through the color input means 211. Hereinafter, such a color is referred to as "a target color". The target color is defined by Dk (Dr, Dg, Db). The target color can be inputted by various methods, for example, by displaying a pallet on the display to select a color therefrom, by inputting color components as numeric data, or by modifying a displayed graph which indicates color components.
(C) The contents of the look-up table memory 205 are changed in the following manner. Since the label information lo of the area in which the color is to be changed has been obtained through the operation described in (A), The function fk.sup.(lo) (x) which corresponds to the label information lo is changed as follows: ##EQU1## In the above, the symbol i indicates a quotient obtained by dividing the input x by 2.sup.2 (i.e., the intensity information), the symbol [ ] is the Gaussian symbol, and the symbol F is the upper limit of the output of the look-up table memory 205.
FIGS. 16(a), 16(b) and 16(c) show the configuration of the functions fk.sup.(lo) (x) (k=r, g, b) obtained in the above.
By setting the function fk.sup.(lo) (x) in this way, the area corresponding to the label information lo is changed in color and displayed as described below. First, the coordinate point designated in (A) and having the information of the reference color is displayed in the target color. Points having a color intensity higher than that of the reference color are displayed in a color brighter than the target color, and points having a color intensity lower than that of the reference color are displayed in a color darker than the target color. Thus, any color of a full-color image can be readily and rapidly changed only by inputting coordinate information which designates the reference color and by inputting color information which designates the target color.
In the above-described system, the components of the colors R, G, B are independently changed. When a specific color is changed to another specific color, shades which have been included in the original image disappear, or the intensity changes suddenly to produce a boundary line in a portion wherein the intensity has varied gradually and continuously so as to produce no boundary line. This problem will be described in more detail.
If all components of both the reference color Ik (Ir, Ig, Ib) and the target color Dk (Dr, Dg, Db) are not almost equal to an extreme value (i.e., the lower limit of 0 or the upper limit of 2.sup.n (n is a bit number) as shown in FIG. 16, the color change can be conducted smoothly without causing the above-mentioned problem. For example, when a color having shades of orange is changed to a greenish blue as shown in FIG. 17, the R component Ir of the reference color is near the upper limit, and the B component Ib is near the lower limit, while the R component Dr of the target color is near the lower limit, and the B component Db is near the upper limit. In this case, the portion 171 in FIG. 17(a) and portion 176 in FIG. 17(c) incline at a small angle so that the color changes gradually. By contrast, the portion 172 in FIG. 17(a) and portion 175 in FIG. 17(c) incline at a very large angle so that the intensity output cf the respective color component is changed to a large degree by a small change of the intensity input. This will be easily understood from FIG. 18 which is an enlarged view of the graph shown in FIG. 17(c).
Both the input Xb and output fb.sup.(lo) (x) are discrete values which are coded in binary form (in FIG. 18, they are expressed by a 5-bit binary number). Therefore, in response to a small change of the input Xb in the steep slope portion 181, the output fb.sup.(lo) (x) changes greatly in a stair-like manner so that many boundary lines, which resemble contour lines in a map appear in the area wherein the intensity has varied continuously. On the other hand, the value of the output fb.sup.(lo) (x) changes very slightly in response to a change of the input Xb in the gentle slope portion 182 so that the shades appearing in the original image disappear, resulting in the image which seems to be painted over with one color.
When an image which consists mainly of one primary color (e.g., red) is to be changed to one which consists almost entirely of another primary color (e.g., green) as shown in FIG. 19, the G component in the image changes little in response to the variation of the R component in the image. Therefore, in the resulting image, there appear many boundary lines which resemble contour lines, or the resulting image appears to be painted over with green. In an extreme case that an image consisting of red only (i.e., the image has the R component alone and has substantially no G and B components) is to be changed to an image consisting of green only, the intensity information possessed by the R component cannot be transferred to the G component. Namely, in a prior art image processing system, a color change between the three primary colors can not be conducted.
In a prior art system, a similar problem which is caused by the discrete values in the look-up table memory arises when an image having a very dark color is to be changed to one having a very bright color as shown in FIG. 20, or when an image having a very bright color is to be changed to one having a very dark color as shown in FIG. 21.